' A QBJS program by vince (https://qb64phoenix.com/forum/showthread.php?tid=1623&pid=15192#pid15192)
' BASIC Anywhere Machine version by Charlie Veniot

dim as double t, u, v, h, x, rr, cc, ss, y, z

r = 50
rr = 100
pi = _pi

SCREEN _NEWIMAGE(640, 480, 23)


DO
    cls   

    t = t + .1

    FOR u = 0 TO 7 STEP .05
        FOR v = 0 TO 7 STEP .1

            h = 100 * SIN(t)
            x = (100 + 50 * COS(u)) * COS(v) + h

            rr = 100 * COS(t)
            cc = (pi / 2) * SIN(t)
            ss = SIN(v) * COS(t) + SIN(t)
            y = (rr + r * COS(u + cc)) * ss

            rr = 100 * SIN(t)
            cc = (pi / 2) * COS(t)
            ss = SIN(v) * SIN(t) + COS(t)
            z = (rr + r * COS(u + cc)) * ss

            bleu = int(z*10)
						if bleu < 255 then bleu = 0 else bleu = 255
            PSET (int(x + 0.707 * z + 320), int(y + 0.707 * z + 240)), _RGB(255, 0, bleu )
        NEXT
    NEXT
    _delay 0.1
LOOP